package com.lhnstart.learn.bases.static_;

/**
 * 小孩玩游戏
 *
 * @author lhn
 * @date 2023/07/10 14:45
 * @since 1.0.0
 **/
public class ChildGame {

    public static void main(String[] args) {
        Child child1 = new Child("张三");
        child1.join();


        Child child2 = new Child("李四");
        child2.join();

        Child child3 = new Child("王五");
        child3.join();

        System.out.println("共有" + Child.count + "个人玩游戏");

    }

}

class Child {

    private String name;

    public static int count = 0;

    public Child(String name) {
        this.name = name;
    }

    public void join() {
        count++;
        System.out.println(name + "加入游戏!");
    }

}